

*** Cox Proportional Hazard model to evaluate the testable implications of stag-elephant game


*** Import the dataset
****************************
*****************************
stset Year, id(dyad_combine)  failure(Bit_agreement) origin(time atrisk)

*****************************MODEL 1********************************************
********************************************************************************
********************************************************************************
***Simplest survival model contains variables for all hypotheses without any covariates
//stcox Cum_bits_byYear is_dyad_in_multilateral learning

stcox is_dyad_in_multilateral dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag 

// I think we should shift to running the lags in all models -- these are part of the main hypothesis being tested in the paper. But in model 1 we should drop the other learning variables. 

// this is the full test of hypothesis -- do we have evidence for significant effect overall from being in a failed multilateral episode?
test is_dyad_in_multilateral dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag

// fixed effects by country
stcox is_dyad_in_multilateral dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag i.ccode_1 i.ccode_2


// this is the full test of hypothesis -- do we have evidence for significant effect overall from being in a failed multilateral episode?
test is_dyad_in_multilateral dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag


*****************************MODEL 2********************************************
********************************************************************************
********************************************************************************
// adding in learning variables

stcox Cum_bits_byYear is_dyad_in_multilateral learning dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag // I think we should shift to running the lags in all models -- these are part of the main hypothesis being tested in the paper. 

// this is the full test of hypothesis -- do we have evidence for significant effect overall from being in a failed multilateral episode?
test is_dyad_in_multilateral dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag


set maxvar 100000

//fixed effects model version 1
//stcox Cum_bits_byYear is_dyad_in_multilateral learning i.ccode_1 i.ccode_2

stcox Cum_bits_byYear is_dyad_in_multilateral learning dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag i.ccode_1 i.ccode_2 // I think we should shift to running the lags in all models -- these are part of the main hypothesis being tested in the paper. 

// this is the full test of hypothesis -- do we have evidence for significant effect overall from being in a failed multilateral episode?
test is_dyad_in_multilateral dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag



****************************MODEL 3*********************************************
********************************************************************************
********************************************************************************
*** Model contains contains variables for all hypotheses with full set of covariates

generate Imfcredit_hostm = Imfcredit_host
replace Imfcredit_hostm = 0 if Imfcredit_host == .
generate Imfcredit_hostd = .
replace Imfcredit_hostd = 0 if Imfcredit_hostm == 0
replace Imfcredit_hostd = 1 if Imfcredit_hostm > 0
generate lnGDP_constant_host = ln(GDP_constant_host)



stcox Cum_bits_byYear is_dyad_in_multilateral learning lnGDP_constant_host GDP_growth_host FDI_inflow_hostLagOneYear FDI_outflow_home colony common_official_lang shortTermDebt_host comcol  trade_volume Imfcredit_hostd dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag

test is_dyad_in_multilateral dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag

//fixed effects version of model 3

stcox Cum_bits_byYear is_dyad_in_multilateral learning lnGDP_constant_host GDP_growth_host FDI_inflow_hostLagOneYear FDI_outflow_home colony common_official_lang shortTermDebt_host comcol  trade_volume Imfcredit_hostd  dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag i.ccode_1 i.ccode_2
 
test is_dyad_in_multilateral dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag

stcox Cum_bits_byYear is_dyad_in_multilateral learning lnGDP_constant_host GDP_growth_host FDI_inflow_hostLagOneYear FDI_outflow_home colony common_official_lang shortTermDebt_host comcol  trade_volume Imfcredit_hostd  dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag i.ccode_1 i.ccode_2 i.Year
 
 test is_dyad_in_multilateral dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag
 
 
*********Runing the same model assuming weibull distribution**********************
**********************************************************************************
***********************Model 1 with weibull distribution**************************

streg is_dyad_in_multilateral dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag, distribution(weibull)

test is_dyad_in_multilateral dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag

**********************************************************************************
***********************Model 2 with weibull distribution**************************
streg Cum_bits_byYear is_dyad_in_multilateral learning dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag, distribution(weibull)

test is_dyad_in_multilateral dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag


*********************************************************************************
***********************Model 3 with weibull distribution*************************
streg Cum_bits_byYear is_dyad_in_multilateral learning lnGDP_constant_host GDP_growth_host FDI_inflow_hostLagOneYear FDI_outflow_home colony common_official_lang shortTermDebt_host comcol  trade_volume Imfcredit_hostd dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag, distribution(weibull)

test is_dyad_in_multilateral dyad_Multi_1yrlag dyad_Multi_2yrlag dyad_Multi_3yrlag dyad_Multi_4yrlag

